<?php

use Illuminate\Support\Facades\Broadcast;


Broadcast::channel('order_paid_success_{orderId}', function ($user) {
    // Only allow authenticated users to listen to the channel
    if (! $user) {
        return false;
    }

    return [
        'id' => $user->id,
    ];
},['guards'=>['apiv2']]);

Broadcast::channel('shop_order_paid_success_{orderId}', function ($user) {
    // Only allow authenticated users to listen to the channel
    if (! $user) {
        return false;
    }
    return [
        'id' => $user->id,
    ];
},['guards'=>['shop']]);


Broadcast::channel('doubt-created', function ($user) {
    // Only allow authenticated users to listen to the channel
    if (! $user) {
        return false;
    }

    return [
        'id' => $user->id,
    ];
});
Broadcast::channel('chat_room_message_.{roomId}', function ($user, $roomId) {
    // Only allow authenticated users to listen to the channel
    if (! $user) {
        return false;
    }

    return [
        'id' => $user->id,

    ];
});

Broadcast::channel('presence-chat.{roomId}', function ($user, $roomId) {
    // Only allow authenticated users to listen to the channel
    if (! $user) {
        return false;
    }

    return [
        'id' => $user->id,
        'name' => $user->name
    ];
});

Broadcast::channel('presence-typing.{roomId}', function ($user, $roomId) {
    // Only allow authenticated users to listen to the channel
    if (! $user) {
        return false;
    }

    return [
        'id' => $user->id,
        'name' => $user->name
    ];
});
